from aiogram import F, Router, types
from aiogram.filters.command import CommandStart

from database import models


router = Router()


@router.message(CommandStart)
async def start_cmd(message: types.Message):
    user, _ = models.TgUser.objects.get_or_create(
        user_id=message.from_user.id,
        defaults={
            'username': message.from_user.username,
            'name': message.from_user.full_name
        }
    )
    await message.answer('Отправьте видео или ссылку на него для поиска: ')


@router.message(F.video)
async def video_handler(message: types.Message):
    await message.answer('Вы прислали видео!')


@router.message()
async def link_handler(message: types.Message):
    await message.answer(message.text)
